package com.renjibo.childred.fragments;


import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;

import com.handmark.pulltorefresh.library.views.MyListView;
import com.renjibo.childred.R;
import com.renjibo.childred.modle.ShoppingBean;
import com.renjibo.childred.views.XiaLa;

import org.litepal.tablemanager.Connector;

/**
 * A simple {@link Fragment} subclass.
 * Use the {@link MybuyFragment#newInstance} factory method to
 * create an instance of this fragment.
 */
public class MybuyFragment extends Fragment implements View.OnClickListener{

    private static final String ARG_PARAM1 = "param1";
    private static final String ARG_PARAM2 = "param2";


    private String mParam1;
    private String mParam2;


    public MybuyFragment() {

    }


    public static MybuyFragment newInstance(String param1, String param2) {
        MybuyFragment fragment = new MybuyFragment();
        Bundle args = new Bundle();
        args.putString(ARG_PARAM1, param1);
        args.putString(ARG_PARAM2, param2);
        fragment.setArguments(args);
        return fragment;
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (getArguments() != null) {
            mParam1 = getArguments().getString(ARG_PARAM1);
            mParam2 = getArguments().getString(ARG_PARAM2);
        }
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_mybuy, container, false);
        initView(view);
        return view;
    }
    public void initView(View view){
        Button shopp_button_location= (Button) view.findViewById(R.id.shopp_button_location);
        shopp_button_location.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            //百度地图定位功能
            case R.id.shopp_button_location:
                getActivity().getSupportFragmentManager().beginTransaction().detach(this).replace(R.id.tabHost,LocationFragment.newInstance("","")).addToBackStack("map").commit();
                break;
        }
    }
}
